package com.tongsys.server.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;


@Data
@TableName("permission")
@ApiModel(value = "Permission对象", description = "")
public class Permission implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId("id")
    private Integer id;

    @ApiModelProperty("权限名称")
    @TableField("label")
    private String label;

    @ApiModelProperty("父级")
    @TableField("parent_id")
    private Integer parentId;

    @ApiModelProperty("授权的 权限标识符")
    @TableField("code")
    private String code;

    @ApiModelProperty("路由地址")
    @TableField("path")
    private String path;

    @ApiModelProperty("路由名称")
    @TableField("name")
    private String name;

    @ApiModelProperty("授权路径")
    @TableField("url")
    private String url;

    @ApiModelProperty("菜单类型 0目录，1菜单，按钮")
    @TableField("type")
    private Byte type;

    @ApiModelProperty("图标")
    @TableField("icon")
    private String icon;

    @ApiModelProperty("创建时间")
    @TableField(value = "create_tm",fill = FieldFill.INSERT)
    private Date createTm;

    @ApiModelProperty("修改时间")
    @TableField(value = "update_tm",fill = FieldFill.INSERT_UPDATE)
    private Date updateTm;

    @ApiModelProperty("备注")
    @TableField("remark")
    private String remark;

    @ApiModelProperty("排序")
    @TableField("order_num")
    private Integer orderNum;

    @ApiModelProperty("是否删除")
    @TableField("is_delete")
    private Byte isDelete;


    /***************************************************************************/
    @JsonInclude(JsonInclude.Include.NON_NULL) //属性值为null 不进行序列化
    @TableField(exist = false)
    @ApiModelProperty("子菜单列表")
    private List<Permission> children=new ArrayList<>();

    @TableField(exist = false)
    @ApiModelProperty("用于前端判断是 菜单、目录、按钮")
    private String value;

    @TableField(exist = false)
    @ApiModelProperty("菜单是否展开")
    private Boolean open;
    /***************************************************************************/
}
